#include <cstdio>

using namespace std;

int main() {
  int N; while (scanf("%d", &N) != EOF) if (N%6 == 0) printf("Y\n"); else printf("N\n");
  return 0;
}
